From 0f01d9bd4ddafbb33317a841bab368556d360951 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Fri, 18 Nov 2016 16:49:55 -0500 Subject: [PATCH] Upload categories specified in the manifest --- src/cargo/core/manifest.rs | 1 + src/cargo/ops/registry.rs | 2 ++ src/cargo/util/toml.rs | 2 ++ src/crates-io/lib.rs | 1 + src/doc/manifest.md | 10 ++++++++-- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs index 93fac21fd..e9bc79609 100644 --- a/src/cargo/core/manifest.rs +++ b/src/cargo/core/manifest.rs @@ -47,6 +47,7 @@ pub struct VirtualManifest { pub struct ManifestMetadata { pub authors: Vec, pub keywords: Vec, + pub categories: Vec, pub license: Option, pub license_file: Option, pub description: Option, // not markdown diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index d937976f8..af80760b6 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -112,6 +112,7 @@ fn transmit(config: &Config, let ManifestMetadata { ref authors, ref description, ref homepage, ref documentation, ref keywords, ref readme, ref repository, ref license, ref license_file, + ref categories, } = *manifest.metadata(); let readme = match *readme { Some(ref readme) => Some(paths::read(&pkg.root().join(readme))?), @@ -142,6 +143,7 @@ fn transmit(config: &Config, homepage: homepage.clone(), documentation: documentation.clone(), keywords: keywords.clone(), + categories: categories.clone(), readme: readme, repository: repository.clone(), license: license.clone(), diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 5e5dc93a6..bcac3d2da 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -304,6 +304,7 @@ pub struct TomlProject { documentation: Option, readme: Option, keywords: Option>, + categories: Option>, license: Option, license_file: Option, repository: Option, @@ -640,6 +641,7 @@ impl TomlManifest { license_file: project.license_file.clone(), repository: project.repository.clone(), keywords: project.keywords.clone().unwrap_or(Vec::new()), + categories: project.categories.clone().unwrap_or(Vec::new()), }; let workspace_config = match (self.workspace.as_ref(), diff --git a/src/crates-io/lib.rs b/src/crates-io/lib.rs index 884460df2..4d8d889f3 100644 --- a/src/crates-io/lib.rs +++ b/src/crates-io/lib.rs @@ -78,6 +78,7 @@ pub struct NewCrate { pub homepage: Option, pub readme: Option, pub keywords: Vec, + pub categories: Vec, pub license: Option, pub license_file: Option, pub repository: Option, diff --git a/src/doc/manifest.md b/src/doc/manifest.md index 9aaab6707..326cd628c 100644 --- a/src/doc/manifest.md +++ b/src/doc/manifest.md @@ -118,10 +118,16 @@ repository = "..." # contents of this file are stored and indexed in the registry. readme = "..." -# This is a small list of keywords used to categorize and search for this -# package. +# This is a list of up to five keywords that describe this crate. Keywords +# are searchable on crates.io, and you may choose any words that would +# help someone find this crate. keywords = ["...", "..."] +# This is a list of up to five categories where this crate would fit. +# Categories are a fixed list available at crates.io/categories, and +# they must match exactly. +categories = ["...", "..."] + # This is a string description of the license for this package. Currently # crates.io will validate the license provided against a whitelist of known # license identifiers from http://spdx.org/licenses/. Multiple licenses can be -- 2.30.2